#include <iostream>

template<typename T>
void Swap(T& a,T& b)
{
    T temp = a;
    a = b;
    b = temp;
}

class Person
{
public:
    Person(const std::string& name,int money):name(name),money(money)
    {

    }
    void show()
    {
        std::cout<<name<<"的钱:"<<money<<std::endl;
    }
    int& GetMoney()
    {
        return money;
    }
private:
    std::string name;
    int money;
};

template<> void Swap<Person>(Person& a,Person& b)
{
    int temp = a.GetMoney();
    a.GetMoney() = b.GetMoney();
    b.GetMoney() = temp;
}

int main()
{
    Person p1("张三",100);
    Person p2("李四",200);
    p1.show();
    p2.show();

    std::cout<<"---交换后---"<<std::endl;

    Swap<Person>(p1,p2);
    p1.show();
    p2.show();
    return 0;
}